package com.crm.pojo;

import com.alibaba.fastjson.annotation.JSONField;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the REFUND database table.
 */
@Entity
@NamedQuery(name = "Refund.findAll", query = "SELECT r FROM Refund r")
public class Refund implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @SequenceGenerator(initialValue = 1, allocationSize = 1, name = "REFUND_REFUNDID_GENERATOR", sequenceName = "SEQ3")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "REFUND_REFUNDID_GENERATOR")
    @Column(name = "REFUND_ID")
    private Long refundId;

    @Column(name = "FK_REFUND_CONTRACT_ID")
    private BigDecimal fkRefundContractId;

    @Column(name = "FK_REFUND_CUSTOMER_ID")
    private BigDecimal fkRefundCustomerId;

    @Column(name = "REFUND_ALREADY_MONEY")
    private BigDecimal refundAlreadyMoney;

    @Column(name = "REFUND_IS_DEL")
    private String refundIsDel;

    @Column(name = "REFUND_MONEY")
    private BigDecimal refundMoney;

    @Column(name = "REFUND_STATE")
    private String refundState;

    @Column(name = "REFUND_TIME")
    @JSONField(format = "yyyy-MM-dd")
    @Temporal(TemporalType.DATE)
    private Date refundTime;

    @Column(name = "REFUND_TOPIC")
    private String refundTopic;

    //bi-directional many-to-one association to RefundDetail
    @OneToMany(mappedBy = "refund")
    @JSONField(serialize = false)
    private List<RefundDetail> refundDetails;

    public Refund() {
    }

    public Long getRefundId() {
        return this.refundId;
    }

    public void setRefundId(Long refundId) {
        this.refundId = refundId;
    }

    public BigDecimal getFkRefundContractId() {
        return this.fkRefundContractId;
    }

    public void setFkRefundContractId(BigDecimal fkRefundContractId) {
        this.fkRefundContractId = fkRefundContractId;
    }

    public BigDecimal getFkRefundCustomerId() {
        return this.fkRefundCustomerId;
    }

    public void setFkRefundCustomerId(BigDecimal fkRefundCustomerId) {
        this.fkRefundCustomerId = fkRefundCustomerId;
    }

    public BigDecimal getRefundAlreadyMoney() {
        return this.refundAlreadyMoney;
    }

    public void setRefundAlreadyMoney(BigDecimal refundAlreadyMoney) {
        this.refundAlreadyMoney = refundAlreadyMoney;
    }

    public String getRefundIsDel() {
        return this.refundIsDel;
    }

    public void setRefundIsDel(String refundIsDel) {
        this.refundIsDel = refundIsDel;
    }

    public BigDecimal getRefundMoney() {
        return this.refundMoney;
    }

    public void setRefundMoney(BigDecimal refundMoney) {
        this.refundMoney = refundMoney;
    }

    public String getRefundState() {
        return this.refundState;
    }

    public void setRefundState(String refundState) {
        this.refundState = refundState;
    }

    public Date getRefundTime() {
        return this.refundTime;
    }

    public void setRefundTime(Date refundTime) {
        this.refundTime = refundTime;
    }

    public String getRefundTopic() {
        return this.refundTopic;
    }

    public void setRefundTopic(String refundTopic) {
        this.refundTopic = refundTopic;
    }

    public List<RefundDetail> getRefundDetails() {
        return this.refundDetails;
    }

    public void setRefundDetails(List<RefundDetail> refundDetails) {
        this.refundDetails = refundDetails;
    }

    public RefundDetail addRefundDetail(RefundDetail refundDetail) {
        getRefundDetails().add(refundDetail);
        refundDetail.setRefund(this);

        return refundDetail;
    }

    public RefundDetail removeRefundDetail(RefundDetail refundDetail) {
        getRefundDetails().remove(refundDetail);
        refundDetail.setRefund(null);

        return refundDetail;
    }

}